package ch.haclyon.driveimageview;


import ohos.media.image.PixelMap;

/**
 * This is the model for the DriveImageView which includes the the main-text
 * the folder-text and the image for the ImageView.
 *
 * @author Yannick Signer
 * @since 1.0.0
 */
public class DriveImageModel {

    /**
     * mainTitle
     */
    private String mainTitle;

    /**
     * folderTitle
     */
    private String folderTitle;

    /**
     * drawable
     */
    private int drawable = ResourceTable.Media_placeholder;

    /**
     * imageBitmap
     */
    private PixelMap imageBitmap;

    /**
     * isDrawable
     */
    private boolean isDrawable = true;

    /**
     * 无参构造
     */
    public DriveImageModel() {
        // nothing to do
    }

    /**
     * The main constructor of the model.
     *
     * @param mainTitle   the bigger title (main-text) on the bottom of the figure.
     * @param folderTitle the smaller title under the divider on the top of the figure.
     * @param drawable    the image as drawable.
     */
    public DriveImageModel(String mainTitle, String folderTitle, int drawable) {
        this.mainTitle = mainTitle;
        this.folderTitle = folderTitle;
        if (drawable != 0) {
            this.drawable = drawable;
        } else {
            this.drawable = ResourceTable.Media_placeholder;
        }
        this.isDrawable = true;
    }

    /**
     * getMainTitle
     *
     * @return String
     */
    public String getMainTitle() {
        return mainTitle;
    }

    /**
     * setMainTitle
     *
     * @param mainTitle mainTitle
     */
    public void setMainTitle(String mainTitle) {
        this.mainTitle = mainTitle;
    }

    /**
     * getFolderTitle
     *
     * @return String
     */
    public String getFolderTitle() {
        return folderTitle;
    }

    /**
     * setFolderTitle
     *
     * @param folderTitle folderTitle
     */
    public void setFolderTitle(String folderTitle) {
        this.folderTitle = folderTitle;
    }

    /**
     * 获取背景
     *
     * @return int
     */
    public int getDrawable() {
        return drawable;
    }

    /**
     * 设置背景
     *
     * @param drawable drawable
     */
    public void setDrawable(int drawable) {
        this.drawable = drawable;
        isDrawable = true;
    }

    /**
     * getImageBitmap
     *
     * @return PixelMap
     */
    public PixelMap getImageBitmap() {
        return imageBitmap;
    }

    /**
     * setImageBitmap
     *
     * @param imageBitmap imageBitmap
     */
    public void setImageBitmap(PixelMap imageBitmap) {
        this.imageBitmap = imageBitmap;
        isDrawable = false;
    }

    /**
     * isDrawable
     *
     * @return boolean
     */
    public boolean isDrawable() {
        return isDrawable;
    }

    /**
     * setIsDrawable
     *
     * @param isDrawable isDrawable
     */
    public void setIsDrawable(boolean isDrawable) {
        this.isDrawable = isDrawable;
    }
}
